package com.itheima.date8;

import java.time.LocalDateTime;
import java.util.Date;

/*
jdk7 和 jdk8 pk
 */
public class Demo {

    public static void main(String[] args) {
        //有当前时间获取 昨天的这个时间
        Date date = new Date();
        long time = date.getTime();
        long zuoTime = time - 1000 * 60 * 60 * 24;
        Date zuoDate = new Date(zuoTime);
        System.out.println(zuoDate);
        //jdk8 如何获取 昨天的这个时间
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime dateTime = now.minusDays(1);
        System.out.println(dateTime);

    }
}
